<template>
    <div class="seeOrganization-view">
        <el-dialog title="查看" :visible.sync="dialogFormVisible" :show-close="showimg"  :close-on-click-modal="showimg">
            <div class="dialog-close-img" @click="closeBox">
                <img src="../../../assets/img/cancel@2x.png"/>
            </div>
            <div class="seeOrganization-view-content">
                <div class="seeOrganization-content-title">用户信息</div>
                <div class="seeOrganization-content">
                    <div class="seeOrganization-content-son">
                        <div class="seeOrganization-content-son-list">
                            <div class="son-list-left">类型：</div>
                            <div class="son-list-right">{{detailsInfoType}}</div>
                        </div>
                        <div  class="seeOrganization-content-son-list">
                            <div class="son-list-left">上级组织：</div>
                            <div class="son-list-right"> {{detailsInfohome.parentName}}</div>
                        </div>
                        <div  class="seeOrganization-content-son-list">
                            <div class="son-list-left">组织名称：</div>
                            <div class="son-list-right"> {{detailsInfo.name}}</div>
                        </div>
                        <div  class="seeOrganization-content-son-list">
                            <div class="son-list-left">联系人：</div>
                            <div class="son-list-right"> {{detailsInfo.linkman}}</div>
                        </div>
                    </div>
                    <div class="seeOrganization-content-son">
                        <div class="seeOrganization-content-son-list">
                            <div class="son-list-left">联系电话：</div>
                            <div class="son-list-right"> {{detailsInfo.linkTel}}</div>
                        </div>
                        <div  class="seeOrganization-content-son-list">
                            <div class="son-list-left">公司名称：</div>
                            <div class="son-list-right"> {{detailsInfo.company}}</div>
                        </div>
                        <div  class="seeOrganization-content-son-list">
                            <div class="son-list-left">公司地址：</div>
                            <div class="son-list-right"> {{seeDetails.companyAddress}}</div>
                        </div>
                        <div  class="seeOrganization-content-son-list">
                            <div class="son-list-left">备注：</div>
                            <div class="son-list-right">{{detailsInfo.remark}}</div>
                        </div>
                    </div>
                </div>
                <div class="seeOrganization-view-botton" @click="editDetails">编辑组织</div>
            </div>
            <div>
                <UserListOrganization :headlist="headlist" :contentlist="list"></UserListOrganization>
                <Pagination :totalpag="totalpag" v-on:currentpage="currentpage"></Pagination>
            </div>
            <div class="seeOrganization-view-botton" @click="distributionhouse">分配楼盘</div>
        </el-dialog>
        <distributionProperties :dialogFormVisible="distributionShowaddhouse" @close="closeDistribution"  :organizationIds="structIdlists"></distributionProperties>
    </div>
</template>
<script>
    import UserListOrganization from '../user/UserListOrganization';
    import distributionProperties from './distributionProperties';
    import Pagination from '../Pagination';
    import {organType} from "../../../utils/constant"
    export default {
        name: "seeOrganization",
        data(){
            return{
                structIdlists:"",
                detailsInfoType:"",
                distributionShowaddhouse:false,
                distributionShow:false,
                organizationId: this.$store.getters.userData.userMsg.id,//组织id
                showimg:false,
                current:1,
                detailsInfo:{},
                rowDetails:{},
                detailsInfohome:{},
                headlist:{
                    checkout:false,
                    operation:{
                        type:false,
                        fromurl:"",
                    },
                    list:[
                        {
                            prop:"id",
                            label:"序号",
                            width:"80",
                        },{
                            prop:"houseName",
                            label:"名称",
                            width:"150",
                        },{
                            prop:"houseType",
                            label:"分类",
                            width:"80",
                        }
                        ,{
                            prop:"address",
                            label:"所在地",
                            width:"130",
                        }
                        ,{
                            prop:"price",
                            label:"价格",
                            width:"80",
                        }
                        ,{
                            prop:"propertyType",
                            label:"物业类型",
                            width:"110",
                        }
                        ,{
                            prop:"auditStatus",
                            label:"审核状态",
                            width:"110",
                        }
                        ,{
                            prop:"propertyType",
                            label:"上架状态",
                            width:"110",
                        }
                    ]},
                list:[],
                totalpag:0,
            }
        },
        components: {
            UserListOrganization,
            Pagination,
            distributionProperties
        },
        props:{
            seeDetails:{
                type:Object,
            },
            dialogFormVisible: {
                type: Boolean
            },
        },
        watch: {
            seeDetails:{
                handler(newValue, oldValue) {
                    if (newValue) {
                        this.rowDetails = newValue
                        this.structIdlists=newValue.id.toString();
                        this.getDetails()
                        this.getlist()
                    }
                }
            }
        },
        mounted(){

        },
        methods: {
            closeDistribution(){
                this.distributionShowaddhouse=false
            },
            //分配楼盘
            distributionhouse(){
                this.$emit("close");
                this.distributionShowaddhouse=true
            },
            //编辑组织
            editDetails(){
                this.$emit("openOrgEdit",this.rowDetails);
                this.$emit("close");
            },
            currentpage(currentpage){
                console.log("当前页，",currentpage)
                this.current=currentpage
                this.getlist()
            },
            closeForm(){
                this.showDetails=false;
                this.rowDetails={}
            },
            //关闭
            closeBox(){
                this.$emit("close");
            },
            getDetails(){
                let _this = this;
                let params={
                    structId:this.seeDetails.id,
                }
                _this.Api.setting.viewStruct(params).then((data)=>{
                    _this.detailsInfo=data.data.struct;
                    _this.detailsInfohome=data.data;
                    _this.detailsInfoType=organType(data.data.struct.type);
                })
            },
            getlist(){
                let _this = this;
                let params={
                    current:_this.current,
                    size:6,
                    distributorId:_this.organizationId,
                }
                _this.Api.setting.queryHouses(params).then((data)=>{

                    _this.totalpag=data.data.total?data.data.total:0;
                    _this.list=data.data.records;
                })
            }
        }
    }
</script>
<style>
    .seeOrganization-view .el-dialog--small {
        width:942px;
    }
    .seeOrganization-view .el-form-item__label {
        text-align: right;
        vertical-align: middle;
        float: left;
        font-size: 14px;
        font-family:PingFangSC-Regular;
        font-weight:400;
        color:rgba(0,0,0,0.85);
        line-height:22px;
        padding: 7px 0px 0px 30px;
        box-sizing: border-box;
    }
    .seeOrganization-view .el-dialog__header{
        height: 50px;
        padding: 10px ;
        text-align: left;
        font-size:16px;
        font-family:PingFangSC-Medium;
        font-weight:500;
        color:rgba(0,0,0,0.85);
        line-height:24px;
    }
    .seeOrganization-view .el-dialog__body{
        border-top: 1px #E9E9E9 solid;
        border-bottom: 1px #E9E9E9 solid;
    }
</style>
<style scoped rel="stylesheet/scss" lang="scss">
    .dialog-close-img{
        width: 18px;
        height: 18px;
        position: absolute;
        top: 16px;
        right: 12px;
        cursor: pointer;
        img{
            width: 18px;
            height: 18px;
        }
    }
    .seeOrganization-view-content{
        .seeOrganization-content-title{
            font-size:16px;
            font-family:PingFangSC-Medium;
            font-weight:500;
            color:rgba(0,0,0,0.85);
            line-height:24px;
        }
        .seeOrganization-content{
            display: flex;
            .seeOrganization-content-son{
            min-width: 290px;
            .seeOrganization-content-son-list{
                    display: flex;
                margin-top: 16px;
                .son-list-left{
                    font-size:14px;
                    font-family:PingFangSC-Regular;
                    font-weight:400;
                    color:rgba(0,0,0,0.85);
                    line-height:22px;
                    min-width: 75px;
                }
                .son-list-right{
                    font-size:14px;
                    font-family:PingFangSC-Regular;
                    font-weight:400;
                    color:rgba(0,0,0,0.65);
                    line-height:22px;
                }
                }
        }
        }

    }
    .seeOrganization-view-botton{
        height:32px;
        line-height: 32px;
        background:rgba(24,144,255,1);
        border-radius:4px;
        width:88px;
        text-align: center;
        font-size:14px;
        font-family:PingFangSC-Regular;
        font-weight:400;
        color:rgba(255,255,255,1);
        margin-top: 16px;
        margin-bottom: 32px;
        cursor:pointer;
    }
</style>